
<?php
/* @var $this BackendController */
/* @var $model Article */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('TActiveForm', array(
	'id'=>'article-form',
    'htmlOptions' => array('enctype' => 'multipart/form-data'),

    // Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>true,
    'enableClientValidation'=>true,
    'clientOptions'=>array(
        'beforeValidate'=>'js:beforeValidate',
        'afterValidate'=>'js:afterValidate',
        'validateOnSubmit'=>true,
        'validateOnType'=>true,
        'validateOnChange'=>true,
        'hideErrorMessage'=>true
    ),

)); ?>

    <div class="alert alert-info">
        <?php echo Yii::t('ArticleModule.base','Fields with')?><span class="required"> * </span> <?php echo Yii::t('ArticleModule.base','are required.')?>
    </div>

    <div class="well well-sm" style="width:900px">
        <?php echo $form->labelEx($model,'category_id'); ?>
        <?php echo $form->dropDownList($model,'category_id',$model->getCategories()); ?>
        <?php echo $form->error($model,'category_id',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
        <span class="well-into">
            <?php echo $form->labelEx($model,'mid'); ?>
            <?php echo CHtml::activeDropDownList($model,'mid',$model->getMenuOptions()); ?>
            <?php echo $form->error($model,'mid',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
        </span>
        <span class="well-into">
            <?php echo $form->labelEx($model,'status'); ?>
            <?php echo CHtml::activeDropDownList($model,'status',$model->getStatusOptions()); ?>
            <?php echo $form->error($model,'status',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
        </span>

    </div>

     <div class="well well-sm" style="width:900px">
            <?php echo $form->labelEx($model,'image'); ?>
            <?php echo $form->activeFileField($model,'image'); ?>
            <?php echo $form->error($model,'image',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
    </div>

	<div class="input-group">
		<?php echo $form->labelTb($model,'title'); ?>
		<?php echo $form->textFieldTb($model,'title',array('size'=>96,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'title',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
	</div>

    <div class="input-group">
        <?php echo $form->labelTb($model,'description'); ?>
        <?php echo $form->textAreaTb($model,'description',array('rows'=>3, 'cols'=>95)); ?>
        <?php echo $form->error($model,'description',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
    </div>

	<div class="input-group">
		<?php echo $form->labelTb($model,'content'); ?>
		<?php echo $form->textAreaEditor($model,'content',array('id'=>'Article_content','width'=>800,'height'=>700)); ?>
		<?php echo $form->error($model,'content',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
	</div>

    <div class="input-group">
        <?php echo $form->labelTb($model,'tags'); ?>
        <?php echo $form->textAreaTb($model,'tags',array('rows'=>1, 'cols'=>95)); ?>
        <?php echo $form->error($model,'tags',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
    </div>

	<div class="row buttons">
		<?php echo $form::submitButtonTb($model); ?>
	</div>

<?php $this->endWidget();?>

</div><!-- form -->